import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetMetricsGroupGetGroupWithMetricsByRootId_ {
  /**
   * @description rootId
   */
  rootId: number;
}
export interface GetMetricsGroupListRoot_ {
  /**
   * @description display
   * @format int32
   */
  display?: number;
  /**
   * @description pageNum
   * @format int32
   */
  pageNum: number;
  /**
   * @description pageSize
   * @format int32
   */
  pageSize: number;
}
export interface GetMetricsGroupMetricsList_ {
  /**
   * @description groupId
   * @format int32
   */
  groupId: number;
  /**
   * @description metricsName
   */
  metricsName: string;
  /**
   * @description 编辑-1/查看-2
   * @format int32
   */
  mode?: number;
  /**
   * @description pageNum
   * @format int32
   */
  pageNum: number;
  /**
   * @description pageSize
   * @format int32
   */
  pageSize: number;
  /**
   * @description rootId
   * @format int32
   */
  rootId: number;
}
export interface GetMetricsGroupRootDisplay_ {
  /**
   * @description 0-隐藏，1-展示
   * @format int32
   */
  display?: number;
  /**
   * @description rootId
   * @format int32
   */
  rootId: number;
}
export interface GetMetricsGroupRootByRootId_ {
  /**
   * @description rootId
   */
  rootId: number;
}
export interface DeleteMetricsGroupRootByRootId_ {
  /**
   * @description rootId
   */
  rootId: number;
}
export interface DeleteMetricsGroupById_ {
  /**
   * @description id
   */
  id: number;
}

export class MetricsGroup {
  /**
   * 添加分类分组
   *
   * @tags 指标分类关系controller
   * @request POST: /metrics-group
   * @secure
   */
  postMetricsGroup = (metricsMarketGroupDTO: defs.MetricsMarketGroupDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/metrics-group`,
      method: "POST",
      data: metricsMarketGroupDTO,
      ...params,
    });

  /**
   * 修改分类分组
   *
   * @tags 指标分类关系controller
   * @request PUT: /metrics-group
   * @secure
   */
  putMetricsGroup = (metricsMarketGroupDTO: defs.MetricsMarketGroupDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/metrics-group`,
      method: "PUT",
      data: metricsMarketGroupDTO,
      ...params,
    });

  /**
   * 查询组带指标情况
   *
   * @tags 指标分类关系controller
   * @request GET: /metrics-group/getGroupWithMetrics/{rootId}
   * @secure
   */
  getMetricsGroupGetGroupWithMetricsByRootId = (
    { rootId }: { rootId: number } | GetMetricsGroupGetGroupWithMetricsByRootId_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityMetricsMarketGroupVO>({
      url: `/metrics-group/getGroupWithMetrics/${rootId}`,
      method: "GET",
      ...params,
    });

  /**
   * 分类节点列表
   *
   * @tags 指标分类关系controller
   * @request GET: /metrics-group/listRoot
   * @secure
   */
  getMetricsGroupListRoot = (
    query: { display?: number; pageNum: number; pageSize: number } | GetMetricsGroupListRoot_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoMetricsMarketGroupVO>({
      url: `/metrics-group/listRoot`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 加入指标api
   *
   * @tags 指标分类关系controller
   * @request POST: /metrics-group/metrics/add
   * @secure
   */
  postMetricsGroupMetricsAdd = (metricsGroupRelDTO: defs.MetricsGroupRelDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/metrics-group/metrics/add`,
      method: "POST",
      data: metricsGroupRelDTO,
      ...params,
    });

  /**
   * 指标list
   *
   * @tags 指标分类关系controller
   * @request GET: /metrics-group/metrics/list
   * @secure
   */
  getMetricsGroupMetricsList = (
    query:
      | { groupId: number; metricsName: string; mode?: number; pageNum: number; pageSize: number; rootId: number }
      | GetMetricsGroupMetricsList_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoMetricsGroupRelVO>({
      url: `/metrics-group/metrics/list`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 创建分类接口
   *
   * @tags 指标分类关系controller
   * @request POST: /metrics-group/root
   * @secure
   */
  postMetricsGroupRoot = (metricsMarketGroupDTO: defs.MetricsMarketGroupDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/metrics-group/root`,
      method: "POST",
      data: metricsMarketGroupDTO,
      ...params,
    });

  /**
   * 隐藏展示
   *
   * @tags 指标分类关系controller
   * @request GET: /metrics-group/root/display
   * @secure
   */
  getMetricsGroupRootDisplay = (
    query: { display?: number; rootId: number } | GetMetricsGroupRootDisplay_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntity>({
      url: `/metrics-group/root/display`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 查询分类分组树
   *
   * @tags 指标分类关系controller
   * @request GET: /metrics-group/root/{rootId}
   * @secure
   */
  getMetricsGroupRootByRootId = (
    { rootId }: { rootId: number } | GetMetricsGroupRootByRootId_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityMetricsMarketGroupVO>({
      url: `/metrics-group/root/${rootId}`,
      method: "GET",
      ...params,
    });

  /**
   * 删除分类接口
   *
   * @tags 指标分类关系controller
   * @request DELETE: /metrics-group/root/{rootId}
   * @secure
   */
  deleteMetricsGroupRootByRootId = (
    { rootId }: { rootId: number } | DeleteMetricsGroupRootByRootId_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntity>({
      url: `/metrics-group/root/${rootId}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 删除分类分组
   *
   * @tags 指标分类关系controller
   * @request DELETE: /metrics-group/{id}
   * @secure
   */
  deleteMetricsGroupById = ({ id }: { id: number } | DeleteMetricsGroupById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/metrics-group/${id}`,
      method: "DELETE",
      ...params,
    });
}

export default new MetricsGroup();
